package com.zoranjoka.chordis.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Session;

import com.zoranjoka.chordis.entities.Album;
import com.zoranjoka.chordis.entities.AlbumBean;

public class AlbumDAOImpl implements AlbumDAO {

	private final Session session;
	
	public AlbumDAOImpl(Session s)
	{
		this.session=s;
	}
	public void save(Album a) {
		session.save(a);
	}

	public void delete(Album a) {
		session.delete(a);
	}

	public Album findById(Serializable id) {
		return (Album) session.get(AlbumBean.class, id);
	}

	public List<Album> getAll() {
		return session.createCriteria(AlbumBean.class).list();
	}

}
